$(function(){
    var url=location.search;
    var Request = new Object();
    if(url.indexOf("?")!=-1){
        var str = url.substr(1);
        strs = str.split("&");
        for(var i=0;i<strs.length;i++){
            Request[strs[i ].split("=")[0]]=unescape(strs[i].split("=")[1]);
        }
    }
    var id = Request["id"];
    //common
    ;(function(){
        var iBShare = {
            //初始化
            init: function() {
                var $shareBox = $(".bshare-custom");
                //加载分享工具
                var tools = '';
                tools = '<a title="分享到QQ空间" class="bshare-qzone"></a>';
                tools += '<a title="分享到腾讯微博" class="bshare-qqmb"></a>';
                tools += '<a title="分享到新浪微博" class="bshare-sinaminiblog"></a>';
                tools += '<a title="分享到微信" class="bshare-weixin"></a>';
//		        tools += '<a title="分享到人人网" class="bshare-renren"></a>';
//		        tools += '<a title="分享到网易微博" class="bshare-neteasemb"></a>';
//		        tools += '<a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>';
                $shareBox.append(tools);
                //绑定分享事件
                $shareBox.children("a").click(function() {
                    var parents = $(this).parent();
                    bShare.addEntry({
                        title: parents.attr("title"),
                        url: parents.attr("url"),
                        summary: parents.attr("summary"),
                        pic: parents.attr("pic")
                    });
                });
            }
        };




        $.ajax({
            url: "hxclub/activity/activitys.do",
            async: false,
            type : "post",
            dataType : "json",
            data:{id:id,pageNo:1,pageSize:4},
            success : function(data){
                console.info(data)
                var $varietyContent = $('#xCont'), varietyHtml = template('xScr', data);

                $varietyContent.html(varietyHtml);
                iBShare.init();

            }
        });

        function TT() {
            ;(function($){
                var aH3=$('#xJsACt h3');
                var aP=$('#xJsaTxt');

                aH3.click(function(){
                    aH3.removeClass('xJsShow');
                    $(this).addClass('xJsShow');
                });

                aH3.eq(0).click(function(){
                    aP.css({
                        'font-size':12+'px',
                        'line-height':26+'px'
                    })
                });
                aH3.eq(1).click(function(){
                    aP.css({
                        'font-size':18+'px',
                        'line-height':38+'px'
                    })
                });
            })(jQuery);
        }
    })();
    var pageCount = 1;
    var pageSize = 2;

    getdata(pageCount, pageSize);
    showdata(pageCount, pageSize);

    // 获取后台数据
    function getdata(pageNo, pageSize){
        $.ajax({
            url: 'hxclub/activity/activitys.do',
            async:false,
            data:{
                pid:id,
                pageNo : pageNo,
                pageSize: pageSize
            },
            type:'POST',
            dataType:"json", success:function(json){
                console.log(json)
                var XHtml= template('lishis5', json);
                $('#lishi5').html(XHtml);

                pageCount = json.data.pageCount;
            }
        })
    }

    // 数据展示
    function showdata(pages, pageSize) {
        //调用分页
        laypage({
            cont: 'biuuu_city',
            pages: pages,
            jump: function(obj){
                getdata(obj.curr, pageSize)
            }
        })
    }
});
/**
 * Created by Administrator on 2016/5/6.
 */
